﻿
Partial Class Setup_Program
    Inherits System.Web.UI.Page

    Dim _CommandName As String
    Dim ProgramObj As New DBProgramSP
    Dim ProgramDataSet As New Data.DataSet

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim _lblPageTitle As Label
            _lblPageTitle = Me.Master.FindControl("lblPageTitle")
            _lblPageTitle.Text = GetLocalResourceObject("PageTitle")
        End If
    End Sub

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Me.Theme = GetGlobalResourceObject("SystemResource", "Theme")
    End Sub

    Protected Sub rgProgram_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgProgram.ItemCommand
        _CommandName = e.CommandName
    End Sub


    Protected Sub CVProgramNo_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
        Try
            If rgProgram.MasterTableView.IsItemInserted Then
                If Not (args.Value Is Nothing) And Not (args.Value = "") Then
                    ProgramDataSet = ProgramObj.QueryDatabase(DBParentStoredProcedureClass.SqlQueryType.FillDataset, "RtvSelectedProgram", args.Value.ToString())
                    If ProgramDataSet IsNot Nothing Then
                        If ProgramDataSet.Tables.Count > 0 Then
                            If ProgramDataSet.Tables(0).Rows.Count > 0 Then
                                args.IsValid = False
                            Else
                                args.IsValid = True
                            End If
                        Else
                            args.IsValid = True
                        End If
                    End If
                    Return
                Else
                    args.IsValid = True
                    Return
                End If
            End If
        Catch ex As Exception
            args.IsValid = False
            Return
        End Try
    End Sub


End Class
